<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/modules/cms/front/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>${course.name}</title>
	<!-- <meta name="decorator" content="cms_default_front"/> -->
	<meta name="description" content="${course.name}" />
	<meta name="keywords" content="${course.name}" />
	<script src="${ctxStatic }/sxdw/js/jquery-1.11.0.min.js" type="text/javascript"></script>
	<script src="${ctxStatic }/sxdw/js/join.js" type="text/javascript"></script>
	<script src="${ctxStatic }/layer/layer.js" type="text/javascript"></script>
	<link rel="stylesheet" href="${ctxStatic }/sxdw/css/index.css" />
	
</head>
<body>
 
<div class="content">
 
	<div class="clear"></div> 
	 <div class="cmain">
	 <h3>收银台</h3>
	 
	 <div class="contentmain pt20">
	 <!------->
	    
	  <div class="zhifutable">
	  	<div class="zfhead">报名申请<b><font color="#c30">提交成功</font></b>，请您尽快付款，完成报名<div class="fr mr20">应付金额：<b><font color="red">${join.order.money}</font></b>元</div></div>
		<div class="zfm">
			<div class="fl" style="width:50%">请您在提交订单后 <b><font color="#c30">2分钟</font></b>内完成支付，否则订单会自动取消。</div>
			<!-- <div class="fl" style="width:50%">请您在报名完成后 尽快支付，否则订单会取消。</div> -->
			<div class="fl" style="width:25%"><b>订单号</b>：${join.order.orderNo }</div>
			<div class="fl" style="width:25%"><b>订单时间</b>：<fmt:formatDate value="${join.order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></div>
			<div class="clear"></div>
			<div style="margin:40px 20px">
			<Div class="zfewm fl">
				<%-- <div class="zfewm01"><img src="${ctxStatic }/sxdw/img/ewm.png"/></div> --%>
				<div class="zfewm01"><img id="qrCodeImg" src="${payQRCodeUrl}"/></div>
				<div class="zfewm02">请使用微信扫一扫，扫描二维码支付</div>
			</Div>
			<div class="fl"><img src="${ctxStatic }/sxdw/img/f_explain.png"/></div>
			</div>
			<div class="clear"></div>
		</div>
	  </div>
	  
	   <br/>
	   
	   <br/><br/>
	 <!-------->
	 </div>
	 </div>
	 
<div class="clear"></div> 
</div>
<div class="clear"></div>
<div class="foot">联系电话：0531-82068489  版权所有：山东星星火炬青少年文化事业发展中心</div>
 
</body>

<script type="text/javascript">
var timeOut;
function showMsg(html)
{
	layer.open({
		  type: 1, //Page层类型
		  area: ['500px', '300px'],
		  title: '信息提示',
		  shade: 0.6, //遮罩透明度
		  maxmin: true, //允许全屏最小化
		  anim: 1, //0-6的动画形式，-1不开启
		  content: "<div style='text-align:center;line-height:200px;font-size: 20px;'>" + html + "</div>",
          btn: ['确定'],
          yes: function(){
        	  location = "${ctx}/";
          }
		});    
}

function checkOrder(){
	if(timeOut)
	{
		clearTimeout(timeOut);
	}
	var interVal = setInterval(function(){
		var clientData = {orderId:"${join.order.orderNo }"};
		$.ajax({
			url:"${ctx}/ems/qryOrderStatus",
			type:"post",
			data:clientData,
			async:false,
			success:function(data){
				if("success" == data.rs)
				{
					if("1" == data.status){
						clearInterval(interVal);
						showMsg("<img style='width:30px;height:30px;' src='${pageContext.request.contextPath}/static/weixin/images/suc.png'/>支付成功！");
						// location = "${ctx}";
					}
					else if("-1" == data.status){
						clearInterval(interVal);
						showMsg("<img style='width:30px;height:30px;' src='${pageContext.request.contextPath}/static/weixin/images/cancel.png'/>您取消了订单，订单已失效！");
						// location = "${ctx}";
					}else
					if("0" != data.status){
						showMsg("<img style='width:30px;height:30px;' src='${pageContext.request.contextPath}/static/weixin/images/failed.png'/>支付失败,请联系管理员！");
						clearInterval(interVal);
						// location = "${ctx}";
					}
				}
			},
			error: function (jqXHR, textStatus, errorThrown) {
	            /*错误信息处理*/
				clearInterval(interVal);
	        }
	    });
		
	},2500);

}

timeOut = setTimeout("checkOrder()",8000);

// 重新定位二维码
/* function toQRcodePay(orderId)
{
	location = "${ctx}/ems/toQRcodePay?order.id=" + orderId;
} */
// 二维码置为无效
function invalidQrCode()
{
	$("#qrCodeImg").attr("src","${ctxStatic }/sxdw/img/qrTimeOut.jpg");
	$("#qrCodeImg").css("cursor","pointer");
	$("#qrCodeImg").click(function(){
		location = "${ctx}/ems/toQRcodePay?order.id=${join.order.id }";
		/* $("#qrCodeImg").attr("src","${ctx}/qrcodeFile/${join.order.orderNo }.jpg");
		$("#qrCodeImg").css("cursor",""); */
		setTimeout("invalidQrCode()",120000);
	});
}
setTimeout("invalidQrCode()",120000);

</script>

</html>